#!/bin/sh
cat -n /Users/kk/Downloads/2022-03-24.log|
grep time|
grep upstrea|
grep x-real-ip|
grep request_id|
head -n 30|
awk 'BEGIN{FS="\"time\":\""} {print $2}'|
awk 'BEGIN{FS="\"accept\"\:"} {print $1}'|
awk 'BEGIN{FS="\"content-length\"\:"} {print $1}'|
awk -F "\"" '{print $1,$11,$(NF-1)}' |
awk -F "\ " 'BEGIN {printf "%20s\t%60s\t %20s\t \n","日期","pv","uv"}
{
    if($1&&$2){
        date = $1" "$2
    }
    if($3){
            url = $3
    }
    if($4){
            ip = $4
    }

    #arr[$1]["pv"] += 1
    print date
    #arr[$1" "$2][ip][] = ip

} END
{
    #printf "%20s \t %60s \t %20s \t \n",
    #date,url,ip
}'
